home *** CD-ROM | disk | FTP | other *** search
/ Dr. Windows 3 / dr win3.zip / dr win3 / PROGRAMR / RTX2000.ZIP / rtx2000 / fc / fc.doc next >
Text File  |  1993-06-08  |  45KB  |  1,531 lines

  1.     fc - A Public Domain FORTH Cross Compiler for the RTX2000                 
  2.  
  3.                          Microcontroller
  4.  
  5.  
  6.  
  7.                             Version 1.14
  8.  
  9.  
  10.  
  11.     
  12.  
  13.  
  14.  
  15.  
  16.  
  17. fc is a FORTH compiler that generates machine code for the 
  18. Harris RTX2000 microcontroller chip.  fc accepts text files generated 
  19. by a text editor and produces optimized object code files for the 
  20. RTX2000.  fc has options for generating annotated object code listings 
  21. and cross reference files which can be incorporated into other 
  22. programs to link variable and word definitions.  fc can also be used 
  23. to produce code for the Harris RTX2010 and RTX2010 specific 
  24. instructions can be added using the #macro and ucode features.  
  25.  
  26.  
  27.  
  28. fc currently runs on an AMIGA or IBM PC compatible computer 
  29. with either a hard disk or ram disk.  fc has been tested using 
  30. AmigaDos 1.3 and MS-DOS 5.0 but, may work with other versions of 
  31. either operating system.   
  32.  
  33.  
  34.  
  35. fc was made possible by the Public Domain version of Berkely 
  36. yacc available on Fred Fish Disk #419.  Many thanks to Bob Corbett and  
  37. those who helped make this public domain version of yacc.
  38.  
  39.  
  40.  
  41. I would also like to thank John Goldsten and Augie Mattheiss 
  42. for their help in debugging and testing the compiler.  John, Augie, 
  43. and the author have developed several programs using the MS-DOS and 
  44. AMIGA versions of the compiler that have been successfully executed on 
  45. RTX2000 target systems.  We normally use the -o output option or the -
  46. e output option for EPROMs.  The EPROM output option has been 
  47. successfully used with a DATAIO UNISITE programmer.  
  48.  
  49.  
  50.  
  51. fc is a Public Domain program so no fee should be charged for 
  52. distribution except for a possible media charge.  fc was developed 
  53. using Aztec C for AMIGA version 3.6A with the default 16 bit integers.  
  54. fc has been ported to MS-DOS and the MS-DOS executable is included in 
  55. the distribution.  That version is identical to the AMIGA version 
  56. except for some details pertaining to memory allocation and the naming 
  57. of some of the source file names.  An experimental Macintosh version 
  58. may also be included in the distribution and it will require MPW. 
  59.  
  60.  
  61.  
  62. fc is currently being used for software development future 
  63. revisions are likely.  We already have had several months experience 
  64. producing and executing code generated by fc.  However, fc is offered 
  65. "as is" and will not necessarily be supported.  Anyone wishing to 
  66. develop large programs for the RTX2000 or RTX2010 may wish to look 
  67. into other development systems or cross compilers from one of the 
  68. several vendors marketing them.  
  69.  
  70.  
  71.  
  72. A test file is included with the distribution to demonstrate 
  73. code production of the compiler.  This output has been checked against 
  74. the instruction set listed in the Harris RTX2000 Programmer's 
  75. Reference Manual.  However, users should check the code production in 
  76. a disassembly output should they run into any really puzzling problems 
  77. when debugging their programs.  We have developed several programs up 
  78. to 4K bytes long and have not run into any code production problems 
  79. for the last couple of months.  
  80.  
  81.  
  82.  
  83.  
  84.  
  85. Background
  86.  
  87.  
  88.  
  89. The RTX2000 microcontroller is a 16 bit microprocessor 
  90. architectureally designed for executing the FORTH language.  The 
  91. RTX2000 instruction set corresponds to FORTH primitive words (like 
  92. SWAP, DROP, @, !, etc) and combinations of primitive words which, in 
  93. some cases, allow several FORTH instructions to be encoded into a 
  94. single RTX2000 instruction.  All RTX2000 instructions execute in one 
  95. or two cycles and are sixteen or thirty-two bits long.  It is common 
  96. to run the RTX2000 at rates of 8MHz to 10MHz making it fast for real 
  97. time control applications.  
  98.  
  99.  
  100.  
  101. The RTX2000 chip includes two onboard stacks (256 deep), one is 
  102. used for parameters and the other is used mainly for subroutine 
  103. returns.  This allows stack operations like SWAP, DROP, etc, to be 
  104. performed without an external memory access.  Likewise subroutine 
  105. returns are done using the onboard return stack making subroutine 
  106. overhead quite low.  In fact, most RTX2000 instructions can be coded 
  107. to perform a return as part of the instruction so, returns often don't 
  108. even require any extra code.
  109.  
  110.  
  111.  
  112. The RTX2000 has several onboard peripherals, including three 
  113. timer/counters and an interrupt controller. For more information on 
  114. the RTX2000, consult the data sheet from Harris semiconductor.  
  115. Potential users are strongly advised to investigate Harris' plan for 
  116. future support of the RTX2000 family before committing to the chip.  
  117.  
  118.  
  119.  
  120. fc should also be compatible with the Harris RTX2010RH which is 
  121. sold as an ASIC.  The RTX2010RH features higher radiation tolerance 
  122. then the RTX2000, a barrel shifter, and a multiply accumulate circuit.  
  123. Support for RTX2010 specific instructions can be added by using the 
  124. macro capability of fc.   
  125.  
  126.  
  127.  
  128.  
  129.  
  130. Running fc 
  131.  
  132.  
  133.  
  134. fc is invoked from the CLI (AMIGA) or MS-DOS by typing:
  135.  
  136.  
  137.  
  138. fc {-lreoxsd} {iaaa} {-tbbb} filename   
  139.  
  140.  
  141.  
  142. fc recognizes nine command line options - l, x, e, o, r, s, d, i and 
  143. t.  The l, x, s, d, i, and t options can be used in any combination 
  144. along with one of the other three options.  All options must proceed 
  145. the source file name.  The source file name is used as the base name 
  146. for generating output files.  If the source file has an extension, the 
  147. extension is removed when forming the output file names.  
  148.  
  149.  
  150.  
  151. The l option writes a disassembled listing of the program into 
  152. a file named filename.lst.  The e option produces two EPROM output 
  153. files named filename.low and filename.hi instead of the default object 
  154. code output.  The r option also generates EPROM files, but the data is 
  155. in a nonstandard bit shuffled format.  The o option produces an 
  156. ascii/hex output file named filename.ols.  The x option generates a 
  157. definition file named filename.x which can be used by other programs 
  158. to access words and variables in the compiled program.  The s option 
  159. prints a symbol table into filename.sym.  The d option turns on the 
  160. conditional compilation.  The i option specifies a directory for 
  161. include files.  Finally, the t option specifies a directory for 
  162. temporary files.
  163.  
  164.  
  165.  
  166. The l option generates an object code listing along with the 
  167. corresponding FORTH source code.  This allows the programmer to check 
  168. how well the code was optimized.  Often a fc listing file will include 
  169. a single line with thirty-two bits of code.  This is done for long 
  170. literal instructions (which are 32 bits long) and when optimizations 
  171. bail-out due to a missing key instruction (often an alu operation, 
  172. fetch, or store).  The listing file also includes any error messages.
  173.  
  174.    
  175.  
  176. The e option generates object code for hi and low byte EPROMs.  
  177. The output format is ASCII/HEX compatible with DATAIO format 51 (or 
  178. 56) and is produced only if no errors occurred during compilation.  
  179. This format consists of a start code, one or more address declarations 
  180. and data blocks, followed by a  stop code and checksum.  After 
  181. compilation, fc will query the user for the EPROM base address.  This 
  182. address is subtracted from the code address to produce an EPROM 
  183. relative address for output files. (If EPROMs are at 0x8000 hex, and 
  184. code starts at 0x8a00, the EPROM files would have address 0xa00 hex)  
  185. The r option generates the same type of files except the data for each 
  186. byte is bit reversed. 
  187.  
  188.  
  189.  
  190. The o option generates object code in an ascii/hex format that 
  191. is compatible with the load block format described later.  Each 16 bit 
  192. entity in the output file is represented by a four digit hexadecimal 
  193. number.  The format consists of a configuration number (equal to the 
  194. compiler version), start address, data word count, control checksum, 
  195. object code, and block checksum.  As with the other output formats, 
  196. code is only produced if there are no compilation errors.  
  197.  
  198.  
  199.  
  200. The x option produces a file with information about the symbols 
  201. used in the program.  This information includes the address of all 
  202. defined words and variables that are